package com.macro.mall.model;

import com.alibaba.fastjson.JSONObject;
import com.macro.mall.common.vo.CurCourseBaseResp;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * mbr_member_history实体类
 *
 * @author gaodx
 *
 */
@Data
@Builder
@AllArgsConstructor
public class MbrMemberHistory implements Serializable{
	/**主键*/
    @ApiModelProperty(value = "主键")
	private Long id; 
	/**课程标识*/
    @ApiModelProperty(value = "课程标识")
	private Long courseId; 
	/**会员标识*/
    @ApiModelProperty(value = "会员标识")
	private Long memberId; 
	/**顺序*/
    @ApiModelProperty(value = "顺序")
	private Integer sort; 
	/***/
    @ApiModelProperty(value = "")
	private Date createTime;
    /**顺序*/
    @ApiModelProperty(value = "课程列表")
    private List<CurCourseBaseResp> list;
	/**
	 * 实例化
	 */
	public MbrMemberHistory() {
		super();
	}
	/**
	 * 实例化
	 * 
	 * @param obj
	 */

	public MbrMemberHistory(JSONObject obj) {
		this();
		if (obj.get("id") instanceof Number) {
			this.setId(((Number) obj.get("id")).longValue());
		}
		if (obj.get("courseId") instanceof Number) {
			this.setCourseId(((Number) obj.get("courseId")).longValue());
		}
		if (obj.get("memberId") instanceof Number) {
			this.setMemberId(((Number) obj.get("memberId")).longValue());
		}
		if (obj.get("sort") instanceof Number) {
			this.setSort(((Number) obj.get("sort")).intValue());
		}
		this.setCreateTime((Date) obj.get("createTime"));
	}
	
	/**
	 * 将当前对象转换为JsonObject
	 * 
	 * @return
	 */
	public JSONObject toJson() {
		JSONObject result = new JSONObject();
		if (this.getId() != null) {
			result.put("id",this.getId());
		}
		if (this.getCourseId() != null) {
			result.put("courseId",this.getCourseId());
		}
		if (this.getMemberId() != null) {
			result.put("memberId",this.getMemberId());
		}
		if (this.getSort() != null) {
			result.put("sort",this.getSort());
		}
		if (this.getCreateTime() != null) {
			result.put("createTime",this.getCreateTime());
		}
		return result;
	}


	@Override
	public String toString() {
		return "MbrMemberHistory [id=" + id + " , courseId=" + courseId + " , memberId=" + memberId + " , sort=" + sort + " , createTime=" + createTime + "  ]";
	
	}
	
	
}
